package com.three.controller;

import com.three.aop.LogAnotation;
import com.three.service.OutLibraryTransferService;
import com.three.vo.OutLibraryVo;
import com.three.vo.OutTransferListVo;
import com.three.vo.R;
import com.three.vo.TransferInformationVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/transferEx")
public class OutLibraryTransferController {
    @Autowired
    private OutLibraryTransferService outLibraryTransferService;
    @GetMapping("getOutLibraryTransfer")
    //平调审核
    public R getOutLibraryTransfer(Integer currentPage, Integer pageSize)
    {
        return outLibraryTransferService.getOutLibraryTransfer(currentPage,pageSize);
    }

    @PostMapping("getTransferInformation")
    //平调信息
    public R getTransferInformation(Integer currentPage, Integer pageSize, @RequestBody TransferInformationVo transferInformationVo)
    {
        return outLibraryTransferService.getTransferInformation(currentPage,pageSize,transferInformationVo);
    }

    @PutMapping("/flattened")
    @LogAnotation("进行平调出库")
    //平调出库
    public R flattened( Integer FlattenedBranchId,@RequestBody List<OutTransferListVo> outTransferListVoList)
    {
        return outLibraryTransferService.flattened(FlattenedBranchId,outTransferListVoList);
    }

    @GetMapping("/getOutTransferGoodsByCid")
    //根据cid查询平调信息
    public R getOutTransferGoodsByCid(Integer cid,Integer currentPage, Integer pageSize)
    {
        return outLibraryTransferService.getOutTransferGoodsByCid(cid,currentPage,pageSize);
    }

    @PutMapping("/pass")
    @LogAnotation("平调出库审核通过")
    //通过
    public R pass(Integer cid)
    {
        return outLibraryTransferService.pass(cid);
    }

    @PostMapping("/reject")
    @LogAnotation("平调出库审核不通过")
    //不通过
    public R reject(@RequestBody OutLibraryVo outLibraryVo)
    {
        return outLibraryTransferService.reject(outLibraryVo);
    }
}
